"""
用户URL配置
"""
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .views import UserViewSet
from .admin_views import AdminUserViewSet, AdminActionLogViewSet, AdminExportViewSet, AdminHealthCheckViewSet

router = DefaultRouter()
router.register(r'', UserViewSet, basename='user')
# 注意：admin相关的路由需要先注册更具体的路径，避免路由冲突
router.register(r'admin/logs', AdminActionLogViewSet, basename='admin-logs')
router.register(r'admin/export', AdminExportViewSet, basename='admin-export')
router.register(r'admin/health', AdminHealthCheckViewSet, basename='admin-health')
router.register(r'admin', AdminUserViewSet, basename='admin-user')

urlpatterns = [
    path('', include(router.urls)),
    path('auth/register/', UserViewSet.as_view({'post': 'register'}), name='register'),
    path('auth/login/', UserViewSet.as_view({'post': 'login'}), name='login'),
]

